package com.github.prontera.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.github.prontera.ApiVersion;
import com.github.prontera.RequestLogging;
import com.github.prontera.common.filter.CurrentUserId;
import com.github.prontera.common.filter.IgnoreAuth;
import com.github.prontera.domain.AppSystemMsg;
import com.github.prontera.model.response.ObjectDataResponse;
import com.github.prontera.service.AppSystemMsgService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;


/**
 * 客户端
 */
@RestController
@Api(value = "系统消息")
@RequestMapping(value = ApiVersion.API_V1_PREFIX+"/system/msg")
public class SystemMsgController{

	@Autowired
	private AppSystemMsgService appSystemMsgService;
	
	
	@ResponseBody
	@IgnoreAuth
	@ApiOperation(value = "查找系统消息",notes = "查找系统消息")
	@RequestMapping(value = "find", method = RequestMethod.POST)
	public ObjectDataResponse<List<AppSystemMsg>> find(@ApiParam(hidden=true,name="登录用户ID")@CurrentUserId Long clientId) {
		AppSystemMsg systemMsg=new AppSystemMsg();
		systemMsg.setClientId(clientId);
		if(systemMsg.getPageSize()==null||systemMsg.getPageSize()<0){
			systemMsg.setPageSize(20);
		}
		return new ObjectDataResponse<List<AppSystemMsg>>(appSystemMsgService.find(systemMsg));
	}

}
